
#{extends 'Admin_main.html' /}
<div class="block span10 " style="margin-left: 20px;">

    <ul class="systemRotes">
        <li>角色信息</li>
        <ul>
            #{list systemRotes,as:'systemRotes'}
                <li><input type="checkbox" value="${systemRotes.Id}" class="systemRotes_Id" >${systemRotes.RoteName}</input></li>
            #{/list}
        </ul>

        <li>
            <a href="#myModa2" data-toggle="modal" class="btn btn-primary"><i class="icon-plus"></i> 添加信息</a>
        </li>
        <li>
            <a href="#myModal" data-toggle="modal" class="btn">删除</a>
        </li>
    </ul>
    <ul class="systemMeunList">
        <li>用户功能 </li>
             <ul>
                 #{list systemMeunList ,as:'systemMeunList'}
                     <li><input type="checkbox" value="${systemMeunList.Id}" class="systemMeunList_ID">${systemMeunList.MenuName}</input></li>
                 #{/list}
             </ul>
        <li>
            <button class="btn btn-primary"><i class="icon-plus"></i> 添加信息</button>
        </li>
        <li>
            <a href="#myModal" data-toggle="modal" class="btn">删除</a>
        </li>
    </ul>

</div>
<ul>
    #{list list,as:'list'}
        <li>
        ${lists.RoteName}
        </li>
    #{/list}
</ul>

<div class="modal small hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="myModalLabel">删除数据</h3>
    </div>
    <div class="modal-body">

        <p class="error-text"><i class="icon-warning-sign modal-icon"></i>你真的要删除该用户数据吗?</p>
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
        <button class="btn btn-danger" data-dismiss="modal" id="delete">删除</button>
    </div>
</div>
<div class="modal small hide fade" id="myModa2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="myModalLabel">添加数据</h3>
    </div>
    <div class="modal-body">

        <p class="error-text">
            <input type="text" name="rote" id="rote" placeholder="请输入角色名称！">
        </p>
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
        <button class="btn btn-primary" data-dismiss="modal" id="add">确定</button>
    </div>
</div>
<style>
    input{
        margin:0px;
    }
    .systemRotes,.systemMeunList{
        float: left;
        width: 90%;
        margin-top:10px;
    }
    .systemRotes li,.systemMeunList li{
        float: left;
        margin-left: 10px;
        padding: 5px;
    }

</style>
<script>

    $("#add").click(function () {
        var rote = $("#rote").val();
        if($.isEmptyObject(rote)){
            return false;
        }else{
            $.ajax({
                type: "POST",
                url: "/admin/rote/create",
                data: {rote:rote},
                dataType: "json",
                success: function(data){
                    if(data==1){
                        alert("添加成功，正在刷新")
                        location.reload();
                    }else if (data==0){
                        alert("添加失败！")
                    }else{
                        alert("不得添加重复数据！")
                    }
                }

            });
        }


    })
</script>
